#!/usr/bin/env python
# -*- encoding: utf-8 -*-

from datetime import datetime
from email.policy import default
from sqlalchemy import Boolean, Column, ForeignKey, Integer, String, DateTime, Enum, Text
from sqlalchemy.orm import relationship
from sqlalchemy.dialects.mysql import INTEGER
from db.database import Base
from common.utils import formatter

class Map(Base):
    __tablename__ = 'map'

    bind_id = Column(INTEGER(11), primary_key=True)
    building_name = Column(String(255), nullable=False, primary_key=True)
    object_name = Column(String(255), nullable=False)
    description = Column(String(255), nullable=True)


    def __init__(self, building_name, object_name):
        self.building_name = building_name
        self.object_name =object_name

    def __repr__(self):
        return 'Map:%s' % self.bind_id

    def to_dict(self):
        new_dict = {}
        for c in self.__table__.columns:
            new_dict[formatter(c.name)] = getattr(self, c.name, None)
        return new_dict
